package homework;

import java.util.Scanner;

/**
 * @classname:demo04
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/8 17:37
 * @version: 0.1
 * @since:1.8
 */
public class demo04 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个文件路径");


        String path = input.next();
        int i1 = path.indexOf("\\");
        String substring1 = path.substring(0, i1);
        System.out.println("盘符:"+substring1);
        int i = path.lastIndexOf("\\");
        String substring = path.substring(i+1);
        String substring2 = path.substring(i1 + 1, i);
        System.out.println("文件库路径:"+substring2);
        String[] split = substring.split("\\.");
        System.out.println("文件名："+split[0]);
        System.out.println("扩展名:"+split[1]);

    }
}
